using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using GwtRpcNet.Rpc;

namespace GwtRpcNet.CustomFieldSerializers
{
    public class ArrayList_CustomFieldSerializer
    {
        public static void DeSerialize(RpcNetReader reader, ArrayList instance)
        {
            int size = reader.ReadInt();
            for (int i = 0; i < size; ++i)
            {
                object obj = reader.ReadObject();
                instance.Add(obj);
            }
        }

        public static void Serialize(RpcNetWriter writer, ArrayList instance)
        {
            int size = instance.Count;
            writer.WriteInt(size);
            foreach (object obj in instance)
            {
                writer.WriteObject(obj);
            }
        }
    }
}
